package com.xwltz.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xwltz.admin.domain.Album;
import com.xwltz.admin.mapper.AlbumMapper;
import com.xwltz.admin.service.IAlbumService;
import com.xwltz.admin.model.response.AlbumResponse;
import com.xwltz.database.mybatisplus.core.ServicePlusImpl;
import com.xwltz.database.page.PageUtils;
import com.xwltz.database.page.TableList;
import org.springframework.stereotype.Service;

/**
 * @description AlbumServiceImpl
 * @information on version 1.0 be created by @xwltz at 2021/12/28 14:07
 */

@Service
public class AlbumServiceImpl extends ServicePlusImpl<AlbumMapper, Album, AlbumResponse> implements IAlbumService {

	@Override
	public TableList<AlbumResponse> getPageList(AlbumResponse album) {
		LambdaQueryWrapper<Album> lqw = new LambdaQueryWrapper<Album>()
//				.eq(album.getNo() <= 0, AlbumEntity::getNo, album.getName())
//				.like(StringUtils.isNotBlank(album.getName()), AlbumEntity::getName, album.getName())
//				.eq(album.getStatus() <= 0, AlbumEntity::getStatus, album.getStatus())
				.orderByAsc(Album::getSort);
		var page = pageVo(PageUtils.buildPagePlus(), lqw);
		return PageUtils.buildDataInfo(page);
	}

	@Override
	public AlbumResponse getById(Long id) {
		return getVoById(id);
	}
}
